package com.we.tickets.controller;

import com.alibaba.fastjson.JSONObject;
import com.we.tickets.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public JSONObject login(@RequestBody JSONObject jsonObject) {
        return userService.login(jsonObject);
    }

    @PostMapping("/signup")
    public JSONObject signup(@RequestBody JSONObject jsonObject) {
        return userService.signup(jsonObject);
    }

    @GetMapping("/getAllUsers")
    public JSONObject getAllUsers() {
        return userService.getAllUsers();
    }
}
